Skip to content

Use normalizer context constants everywhere #12582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

l-vo
Copy link
Contributor

@l-vo l-vo commented Nov 3, 2019

No description provided.

@OskarStark
Copy link
Contributor

Hi @l-vo 👋 ,

first of all thanks for your contribution.
Can you explain a bit why we should change it this way? To me its less readable.

Cheers 🙏

@l-vo
Copy link
Contributor Author

l-vo commented Nov 3, 2019

Hi @OskarStark :)

Some examples used context constants and some others not. I thought it was an oversight for the examples that didn't use constants. Furthermore I think using constants in the doc allows to advise the developpers that context constants exist and that they should use them instead of magic strings.

@OskarStark
Copy link
Contributor

Thank you for your feedback!
Personally I am against using the constants here, but let’s see what the other say.
@xabbuh @javiereguiluz

@l-vo
Copy link
Contributor Author

l-vo commented Nov 4, 2019

@OskarStark No problem ! Thank you for your feedback too :)

@javiereguiluz
Copy link
Member

I'd say we should do this ... but it's sad that the constants are so long and ugly 😢

Copy link
Contributor

@dbrumann dbrumann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer the "magic strings" here as I find it easier to read, but either is fine so 👍

@OskarStark
Copy link
Contributor

@javiereguiluz this should go into 3.4, right?

@OskarStark OskarStark removed this from the 4.3 milestone Nov 5, 2019
wouterj added a commit that referenced this pull request Nov 9, 2019
This PR was merged into the 4.3 branch.

Discussion
----------

Use normalizer context constants everywhere

Commits
-------

70f84af Use normalizer context constants everywhere
@wouterj wouterj merged commit 70f84af into symfony:4.3 Nov 9, 2019
@wouterj
Copy link
Member

wouterj commented Nov 9, 2019

Thanks @l-vo! I agree with everything that's said here: It's sad that these constants aren't the nicest constants, but it seems to be commonly accepted that constants are favored over "magic strings".

@OskarStark you're correct that this in theory applies to 3.4 as well. I merged it in 4.3 however, because there were quite some changes in the options between 3.x and 4.x (DEEP_OBJECT stuff). This isn't a major thing, so only fixing it in the latest branches isn't a huge deal I think (and fixing it in 3.4 and 4.3 takes a some of time).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants